<template>
    <div>
        <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="date" label="日期" width="180">
            </el-table-column>
            <el-table-column prop="name" label="姓名" width="180">
            </el-table-column>
            <el-table-column prop="address" label="地址">
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button size="mini" @click="dialogVisible = true,handleEdit(scope.$index, scope.row)">编辑</el-button>
                </template>
            </el-table-column>
        </el-table>

          <el-dialog title="修改" :visible.sync="dialogVisible" width="30%">

            <el-form>
                <el-form-item>
                    <el-input v-model="Editdata.date" auto-complete="off"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model="Editdata.name" auto-complete="off"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model="Editdata.address" auto-complete="off"></el-input>
                </el-form-item>
               
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
export default {
  data() {
    return {
         dialogVisible: false,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        }
      ],
       Editdata: []
    };
  },
  methods:{
      handleEdit(index, row) {
      this.Editdata = this.tableData[index];
      }
  }
};
</script>